<script setup>
defineProps({
  title: {
    type: String,
    required: true
  }
})
</script>

<template>
  <el-card class="card">
    <!-- 头部部分 -->
    <template #header>
      <div class="card-header">
        <span>{{ title }}</span>
        <div class="extra">
          <slot name="extra"></slot>
        </div>
      </div>
    </template>

    <!-- 主体内容部分 -->
    <slot></slot>

    <!-- 尾部部分 -->
    <template #footer>
      <slot name="footer"></slot>
    </template>
  </el-card>
</template>

<style lang="scss" scoped>
.card {
  width: auto;
  height: auto;

  .card-header {
    display: flex;
    justify-content: center;

    span {
      font-size: 20px;
      margin: 10px 0;
      font-weight: bold;
    }
  }
}
</style>
